package sf.lambda;

import sf.core.DBField;
import sf.core.DBObject;
import sf.database.dialect.DBDialect;
import sf.lambda.LambdaExample.Criteria;

import java.util.Collection;

/**
 *
 */
public class LambdaSqls {
    private Criteria criteria;

    private LambdaSqls(DBDialect dialect, Class<? extends DBObject> clz) {
        this.criteria = new Criteria(dialect, clz);
    }

    public static LambdaSqls custom(DBDialect dialect, Class<? extends DBObject> clz) {
        return new LambdaSqls(dialect, clz);
    }

    public Criteria getCriteria() {
        return criteria;
    }

    public LambdaSqls isNull(DBField property) {
        this.criteria.isNull(property);
        return this;
    }

    public LambdaSqls isNotNull(DBField property) {
        this.criteria.isNotNull(property);
        return this;
    }

    public LambdaSqls eq(DBField property, Object value) {
        this.criteria.eq(property, value);
        return this;
    }

    public LambdaSqls ne(DBField property, Object value) {
        this.criteria.ne(property, value);
        return this;
    }

    public LambdaSqls gt(DBField property, Object value) {
        this.criteria.gt(property, value);
        return this;
    }

    public LambdaSqls ge(DBField property, Object value) {
        this.criteria.ge(property, value);
        return this;
    }


    public LambdaSqls lt(DBField property, Object value) {
        this.criteria.lt(property, value);
        return this;
    }

    public LambdaSqls le(DBField property, Object value) {
        this.criteria.le(property, value);
        return this;
    }

    public LambdaSqls in(DBField property, Collection<?> values) {
        this.criteria.in(property, values);
        return this;
    }

    public LambdaSqls notIn(DBField property, Collection<?> values) {
        this.criteria.notIn(property, values);
        return this;
    }

    public LambdaSqls between(DBField property, Object value1, Object value2) {
        this.criteria.between(property, value1, value2);
        return this;
    }

    public LambdaSqls notBetween(DBField property, Object value1, Object value2) {
        this.criteria.notBetween(property, value1, value2);
        return this;
    }

    public LambdaSqls like(DBField property, String value) {
        this.criteria.like(property, value);
        return this;
    }

    public LambdaSqls like(DBField property, String value, char escape) {
        this.criteria.like(property, value, escape);
        return this;
    }

    public LambdaSqls like(DBField property, String value, boolean escape) {
        this.criteria.like(property, value, escape);
        return this;
    }

    public LambdaSqls notLike(DBField property, String value) {
        this.criteria.like(property, value);
        return this;
    }

    public LambdaSqls notLike(DBField property, String value, char escape) {
        this.criteria.like(property, value, escape);
        return this;
    }

    public LambdaSqls notLike(DBField property, String value, boolean escape) {
        this.criteria.like(property, value, escape);
        return this;
    }
}